#pragma once

//#include "stdio.h"
#include "GetEphemInterface.h"
#include "StdString.h"


#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif
#pragma warning(disable : 4996)

// #ifndef LPCTSTR
// #ifdef UNICODE
// typedef const WCHAR * LPCTSTR;
// #else
// typedef const char * LPCTSTR;
// #endif
// #endif

class CEphemWrapper: public IGetCoord, public CRefCountedAdapterBase
{
	typedef auto_ptr<IGetCoord> IGetCoordPtr;
public:
	enum eWorkType
	{
		eDE,
		eEPM,
	};
	typedef CRefCounted<CEphemWrapper> Ptr;

	CEphemWrapper (LPCTSTR stzEphemPath, eWorkType eType);
	virtual ~CEphemWrapper (void);

	bool GetCoord(double date, bool bBaryCenter, AllBodies & coords, bool bGetVelocity);

	static bool DateFromJD(double tjd, int &year, int &month, int &date, double &daypart);
	static CStdString StrDateFromJD(double jd);
	static LPCTSTR GetBodyName(eBodies body);

	static double AUtoKM(double dAU);
	static double KMtoAU(double dKM);

	static double AUDtoMS(double dAUperDay);
	static double MStoAUD(double dMperSec);
protected:
	double * GetPosBuffer(double dTime);
	double * GetVelBuffer(double dTime);
protected:
	const static double s_dKmInAu;
	const static double s_dSecInDay;

	IGetCoordPtr	m_pInnerEphem;
};

